// node 语法
const path = require('path');
const webpack = require('webpack');
const htmlWebpackPlugin = require('html-webpack-plugin');
const UglifyjsWebpackPlugin = require('uglifyjs-webpack-plugin');

module.exports = {
    entry: './src/main.js',
    output: {
        path: path.resolve(__dirname,'dist'),
        filename : 'bundle.js'
    },
    module: {
        rules: [
          {
            test: /\.m?js$/,
            exclude: /(node_modules|bower_components)/,
            use: {
              loader: 'babel-loader',
              options: {
                presets: ['es2015']
              }
            }
          }
        ]
    },
    plugins: [
        new webpack.BannerPlugin('随便用哈哈哈哈哈'),
        new htmlWebpackPlugin({ title: '随便玩哈哈哈' }),
        new UglifyjsWebpackPlugin()
    ]
}